<?php
namespace app\admin\controller;

use app\admin\logic\ClientLogic;
use think\Request;

class Client extends Base{
	private $clienLogic;
	public function __construct( Request $request = null ) {
		parent::__construct( $request );
		$this->clienLogic=new ClientLogic();
	}

	// 列表页
	public function index(){
		$clients=$this->clienLogic->query('');
		$this->assign('list',$clients);
		return $this->fetch();
	}

	/**
	 * 接待人员打开的列表页面
	 * @return mixed
	 */
	public function indexClient(){
		return $this->fetch();
	}

	/**
	 * 打开提醒客户界面
	 * @return mixed
	 */
	public function notifyClient(){
		return $this->fetch();
	}

	// 获取客户数据
	public function getClients($page=1,$rows=10,$q=''){
		$clientLogic=new ClientLogic();
		$data=$clientLogic->queryJqGrid('',$page,$rows,$q);
		return $data;
	}

	//新增用户页面
	public function add($id=0){
		$client=null;
		if($id>0){
			$client=$this->clienLogic->findOne($id);
		}
		$this->assign('client',$client);
		return $this->fetch();
	}

	//保存数据
	public function doAdd($param=''){
		$userArr=json_decode($param,true);
		$res=$this->clienLogic->add($userArr);
		return $res;
	}

	//删除数据
	public function del($id=0){
		$res=$this->clienLogic->del($id);
		return $res;
	}
}


